<template>
  <div class="big_box">
    <div v-if="userstate&&userstate.audit_state=='审核通过'" >
        温馨提醒：您的个人信息已经审核通过，请单击此处 <span @click="downloadImg" style="color:#1890ff;cursor: pointer;">下载附件</span>
      <div style="display:flex;margin-bottom:20px;flex-wrap: wrap;">
        <p style="margin:0;">若您已经下载并盖章,请点击此处</p>
          <!-- action="/admin/MemberApply/upload" -->
        <el-upload
          :action="baseUrl+'/admin/MemberApply/upload'"
          multiple
          :limit="3"
          :show-file-list='true'
          :file-list='fileListImg'
          name='img'
          accept='image/*'
          :on-success='fileSuccess'
          :on-remove='removeFile'
          :class='phonePass?"":"sirUpload"'
          >
          <!--  -->
          <p style="color:#1890ff;cursor: pointer;margin:0;">上传附件</p>
          <!-- <el-button size="small" type="primary"></el-button> -->
        </el-upload>
        (仅限上传三张图片)
      </div>
    </div>
    <div v-if="userstate&&userstate.audit_state=='待审核'">
      <p style="margin:0;">您的个人信息正在审核中,请等待管理员通知。</p>
    </div>
    <div style="width: 100%; height: calc(100% - 32px); display: flex">
      <div
        v-if="
          http.indexOf('taihua') == -1 ||
          (http.indexOf('taihua') != -1 && formLabelAlign.gz != '学历提升')
        "
      >
      <el-form-item
                  :label="item.field_type != 'json' && item.field_type != 'jsonTree'
                    ? item.label
                    : ''"
                  v-for="item in fromList"
                  :key="item.id"
                  :required="Boolean(item.selected)"
                  v-show="item.isshow"
                  :class="item.field_type == 'json' ? 'classJson' : ''"
                >
                  <span v-if="item.hint" style="color: red; line-height: 20px !important">{{ item.hint }}</span>
                  <!-- <el-cascader
                    style="width: 100%"
                    v-if="item.field_type == 'select' && item.label == '培训科目'"
                    v-model="subjectlist"
                    @change="subChange"
                    class="filter-item"
                    placeholder="请选择培训科目"
                    clearable
                    :options="subjectListTree"
                    :props="{ label: 'title', value: 'id', key: 'id' }"
                    ref="elcascader"
                  ></el-cascader> -->
                  <el-input v-model="userInfo.subjectTitleFull" disabled="disabled" v-if="item.field_type == 'select' && item.label == '培训科目'"></el-input>
                  <el-input v-model="item.placeholder" v-else-if="item.field_type == 'input'" @change="inputChange(item)"></el-input>
                  <!-- <el-date-picker
                    v-else-if="item.field_type == 'datetimeRange'"
                    v-model="item.placeholder"
                    @change="inputChange(item, 'time')"
                    value-format="yyyy-MM-dd"
                    type="daterange"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                  >
                  </el-date-picker> -->
                  <div v-else-if="item.field_type == 'datetimeRange'">
                        <el-date-picker
                          v-model="item.placeholder[0]"
                          type="date"
                          value-format="yyyy-MM-dd"
                          @change="inputChange(item,'time')"
                          placeholder="选择日期"
                        >
                        </el-date-picker>
                        <span>至</span>
                        <el-input v-model="item.placeholder[1]" v-if="item.placeholder[1]=='至今'" readonly @click.native="clickInput(item)"></el-input>
                        <el-date-picker
                          v-else
                          v-model="item.placeholder[1]"
                          type="date"
                          value-format="yyyy-MM-dd"
                          @change="inputChange(item,'time')"
                          @blur="()=>{!item.placeholder[1]?item.placeholder[1]='至今':item.placeholder[1]
                          $forceUpdate()
                          }"
                          placeholder="选择日期"
                          ref="updataDatePicker"
                        >
                        </el-date-picker>
                      </div>
                  <el-input
                    v-model="item.placeholder"
                    type="textarea"
                    v-else-if="item.field_type == 'textarea'"
                    @change="inputChange(item)"
                    :maxlength="1000"
                    :show-word-limit="item.label == '学习工作经历'"
                    :rows="item.label == '学习工作经历' ? 5 : 2"
                  ></el-input>
                  <el-input v-model="item.placeholder" v-else-if="item.field_type == 'number'" type="number" @change="inputChange(item)"></el-input>
                  <el-radio-group v-model="item.placeholder" v-else-if="item.field_type == 'radio'" @change="inputChange(item)">
                    <el-radio :label="el.e" v-for="el in JSON.parse(item.options)" :key="el.e">{{ el.e }}</el-radio>
                  </el-radio-group>
                  <el-select
                    style="width: 100%"
                    @change="inputChange(item)"
                    v-model="item.placeholder"
                    placeholder="请选择"
                    v-else-if="item.field_type == 'select' && item.label != '培训科目' && item.field_id != 'region_id' && item.options"
                  >
                    <el-option v-for="it in JSON.parse(item.options)" :key="it.e" :label="it.label ? it.label : it.e" :value="it.e"> </el-option>
                  </el-select>
                  <el-cascader
                    v-else-if="item.field_id == 'region_id'"
                    v-model="item.placeholder"
                    class="filter-item"
                    placeholder="请选择工作地点"
                    clearable
                    :props="{
                      lazy: true,
                      lazyLoad: lazyLoad,
                      label: 'region_name',
                      value: 'region_id',
                      key: 'region_id',
                    }"
                    @change="inputChange(item, 'region_id')"
                  ></el-cascader>
                  <div v-if="item.field_id == 'id_card'" style="display: flex;">
                    <div  style="display: flex; align-items: center;flex-direction: column;">
                      <upload
                        action="/admin/MemberApply/upload"
                        accept="image/*"
                        :data="{ field: 'id_card_photo' }"
                        :fileList="item.id_card_photo"
                        :plain="false"
                        @change="upChange($event, 'id_card_photo')"
                        @remove="remove('id_card_photo')"
                        @PictureCard="PictureCard({...item,field_id:'id_card_photo'}, $event)"
                        :ref="'imgid_card_photo'"
                        :limit="1"
                        @PictureEditBack="PictureEditBack({...item,field_id:'id_card_photo'}, $event)"
                      />
                      <span style=" color:#f00; display: block;margin-top: 12px;"
                        >
                        身份证人像面
                        </span
                      >
                      <span style=" cursor: pointer; color: blue; display: block;margin-top: 12px;"  v-if="item.others&&item.others.defImg"
                        ><span @click="openDefimg(item.others.defImg[0])">查看示例图片</span></span
                      >
                      
                    </div>
                    <div  style="display: flex; align-items: center;flex-direction: column;">
                      <upload
                        action="/admin/MemberApply/upload"
                        accept="image/*"
                        :data="{ field: 'id_card_emblem' }"
                        :fileList="item.id_card_emblem"
                        :plain="false"
                        @change="upChange($event, 'id_card_emblem')"
                        @remove="remove('id_card_emblem')"
                        @PictureCard="PictureCard({...item,field_id:'id_card_emblem'}, $event)"
                        :ref="'img' + 'id_card_emblem'"
                        :limit="1"
                        @PictureEditBack="PictureEditBack({...item,field_id:'id_card_emblem'}, $event)"
                      />
                      <span style=" color:#f00; display: block;margin-top: 12px;"
                        >
                        身份证国徽面
                        </span
                      >
                      <span style="margin-top: 12px; cursor: pointer; color: blue; display: block" v-if="item.others&&item.others.defImg"
                        ><span @click="openDefimg(item.others.defImg[0])">查看示例图片</span></span
                      >
                    </div>
                  </div>
                  <div v-else-if="item.field_type == 'img'&&item.field_id != 'id_card'" style="display: flex; align-items: center">
                    <upload
                      action="/admin/MemberApply/upload"
                      accept="image/*"
                      :data="{ field: item.field_id }"
                      :fileList="item.fileList"
                      :plain="false"
                      @change="upChange($event, item.field_id)"
                      @remove="remove(item.field_id)"
                      @PictureCard="PictureCard(item, $event)"
                      :ref="'img' + item.field_id"
                      :limit="item.field_id == 'last_cert' ? 2 : 1"
                      :PictureEditBackIf="setting.backgroundPhoto&&setting.backgroundPhoto=='是'&&item.field_id=='photo'"
                      @PictureEditBack="PictureEditBack(item, $event)"
                    />
                    <span style="margin-left: 10px; cursor: pointer; color: blue; display: block" v-if="item.others&&item.others.defImg"
                      ><span @click="openDefimg(item.others.defImg[0])">查看示例图片</span></span
                    >
                    <el-button
                      type="text"
                      v-if="item.others && item.others.appendix"
                      @click="downFuled(item.others.appendix)"
                      style="color: #166aff"
                      >附件下载</el-button
                    >
                  </div>
                  <el-date-picker
                    v-else-if="item.field_type == 'datetime'"
                    v-model="item.placeholder"
                    type="date"
                    value-format="yyyy-MM-dd"
                    @change="inputChange(item)"
                    placeholder="选择日期"
                  >
                  </el-date-picker>
                  <!-- <div v-else-if="item.field_type == 'json'" v-show="item.isshow">
                    <el-form-item :label="it.label" v-for="(it, index) in JSON.parse(item.options)" :key="index" :required="Boolean(item.selected)">
                      <el-input v-model="JsonListFrom[it.label]" @change="inputChange(item, 'json')" v-if="it.field_type == 'input'"></el-input>
                      <el-date-picker
                        @change="inputChange(item, 'json')"
                        v-if="it.field_type == 'datetime'"
                        v-model="JsonListFrom[it.label]"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="选择日期"
                      >
                      </el-date-picker>
                    </el-form-item>
                  </div> -->
                  <div v-else-if="item.field_type == 'autowrite'">
                    <div>
                      <el-button type="primary" @click="writeName(item.field_id, 'DomImg' + (item.field_id=='edu_photo'?'xlcn':item.field_id))" v-if="!formLabelAlign[item.field_id]">签名</el-button>
                      <img v-else :src="formLabelAlign[item.field_id]" alt="" style="width: 120px; height: 60px; cursor: pointer" @click="writeName(item.field_id, 'DomImg' + (item.field_id=='edu_photo'?'xlcn':item.field_id))" />
                      <span style="margin-left: 50px; cursor: pointer; color: red" @click="openBook">阅读{{ item.label }}</span>
                    </div>
                  </div>
                  <div v-else-if="item.field_type == 'sign'">
                    <div>
                      <el-button type="primary" @click="writeName(item.field_id, null)" v-if="!formLabelAlign[item.field_id]">签名</el-button>
                      <img v-else :src="formLabelAlign[item.field_id]" alt="" style="width: 120px; height: 60px; cursor: pointer" @click="writeName(item.field_id, null)" />
                      <span style="margin-left: 50px; cursor: pointer; color: red" @click="openBook">阅读{{ item.label }}</span>
                    </div>
                  </div>
                  <template v-else-if="item.field_type == 'jsonTree'">
                    <el-form-item
                    style="margin-left:-150px !important;"
                    :label="
                      it.field_type != 'json' && it.field_type != 'jsonTree'
                        ? it.label
                        : ''
                    "
                    :required="
                      item.field_type != 'json' &&
                      it.field_type != 'jsonTree' &&
                      Boolean(item.selected)
                    "
                    v-for="(it, index) in JSON.parse(item.options)"
                    :key="index + 15854"
                    >
                      <el-input v-model="it.placeholder" v-if="it.field_type == 'input'" @change="inputChange(it)"></el-input>
                      <el-select
                        style="width: 100%"
                        @change="inputChange(it,'',$event)"
                        v-model="formLabelAlign[it.field_id]"
                        placeholder="请选择"
                        v-else-if="it.field_type == 'select'&&it.options"
                      >
                        <el-option v-for="el,index in it.options" :key="index" :label="el.e ? el.e : el" :value="el"> </el-option>
                      </el-select>
                      <div v-else-if="it.field_type == 'datetimeRange'">
                        <el-date-picker
                          v-model="it.placeholder[0]"
                          type="date"
                          value-format="yyyy-MM-dd"
                          @change="inputChange(it,'time')"
                          placeholder="选择日期"
                        >
                        </el-date-picker>
                        <span>至</span>
                        <el-input v-model="it.placeholder[1]" v-if="it.placeholder[1]=='至今'" readonly @click.native="clickInput(it)"></el-input>
                        <el-date-picker
                          v-else  
                          v-model="it.placeholder[1]"
                          type="date"
                          value-format="yyyy-MM-dd"
                          @change="inputChange(it,'time')"
                          placeholder="选择日期"
                          ref="updataDatePicker"
                          @blur="()=>{!it.placeholder[1]?it.placeholder[1]='至今':it.placeholder[1]
                            $forceUpdate()
                          }"
                        >
                        </el-date-picker>
                      </div>
                      <div v-else-if="it.field_type == 'img'" style="display: flex; align-items: center">
                        <upload
                          action="/admin/MemberApply/upload"
                          accept="image/*"
                          :data="{ field: it.field_id }"
                          :fileList="it.fileList"
                          :plain="false"
                          @change="upChange($event, it.field_id)"
                          @remove="remove(it.field_id)"
                          @PictureCard="PictureCard(it, $event)"
                          :ref="'img' + it.field_id"
                          :limit="it.field_id == 'last_cert' ? 2 : 1"
                          :PictureEditBackIf="setting.backgroundPhoto&&setting.backgroundPhoto=='是'&&it.field_id=='photo'"
                          @PictureEditBack="PictureEditBack(it, $event)"
                        />
                        <span style="margin-left: 10px; cursor: pointer; color: blue; display: block" v-if="it.defImg"
                          ><span @click="openDefimg(it.defImg)">查看示例图片</span></span
                        >
                      </div>
                       <div v-if="it.field_type == 'sign'">
                        <el-button type="primary" @click="writeName(it.field_id, null)" v-if="!formLabelAlign[it.field_id]">签名</el-button>
                        <img v-else :src="formLabelAlign[it.field_id]" alt="" style="width: 120px; height: 60px; cursor: pointer" @click="writeName(it.field_id, null)" />
                        <span style="margin-left: 50px; cursor: pointer; color: red" @click="openBookalert(it,it.label)">阅读{{ it.label }}</span>
                      </div>
                    </el-form-item>
                   
                  </template>
                  <template v-if="item.field_type=='download'">
                    <el-button class="button" type="primary" @click="downloadImg2(item.others)"
                      >下载</el-button
                    >
                  </template>
                </el-form-item>
                <el-form-item label="燃气主管部门" required v-if="http.indexOf('bosheng') != -1&&formLabelAlign.gz=='燃气从业人员培训'">
                  <el-cascader
                    v-model="deptitle"
                    :options="depList"
                    class="filter-item"
                    placeholder="请选择部门"
                    clearable
                    :props="{
                      label:'title',
                      value:'id',
                    }"
                    @change="depchange"
                  ></el-cascader>
                </el-form-item>
                <el-form-item label="验证码" v-if="!qyType('hzdpx') || !qyType('xtaq') || (!qyType('zcaq') && formLabelAlign.gz == '大培训')">
                  <div style="display: flex; width: 100%">
                    <el-input style="flex: 1" v-model="codeChk"> </el-input>
                    <div style="height: 40px; display: flex; align-items: center; min-width: 70px; margin-left: 5px">
                      <el-button type="primary" style="height: 100%" @click="hoveCode" v-if="hascodeYes">获取验证码</el-button>
                      <div v-else style="height: 100%; width: 70px; border: 1px solid #eee; display: flex; align-items: center; justify-content: center; color: #000">
                        {{ codeTime }}s
                      </div>
                    </div>
                  </div>
                </el-form-item>
                <div v-if="objinvoice[formLabelAlign.gz] == '开启'">
                  <el-form-item label="发票税号">
                    <el-input v-model="shuihao"></el-input>
                  </el-form-item>
                  <el-form-item label="发票户头">
                    <el-input v-model="hutou"></el-input>
                  </el-form-item>
                  <el-form-item label="发票截图">
                    <upload
                      action="/admin/MemberApply/upload"
                      accept="image/*"
                      :data="{ field: 'image' }"
                      :fileList="FpfileList.fileList"
                      :plain="false"
                      @change="upChange"
                      @remove="remove('image')"
                      @PictureCard="PictureCard(FpfileList, $event)"
                      :ref="'imgimage'"
                    />
                  </el-form-item>
                </div>
      </div>
    </div>
    <el-button @click="commit">提交</el-button>
    <simpleCrop
      :crop-params="cropParams"
      @crop="crop"
      v-if="isShowImgCard"
      @close="closeCallback"
    ></simpleCrop>
    <el-dialog title="签名" :visible.sync="dialogShow" width="60%">
      <div style="width: 100%; display: flex; justify-content: center">
        <autograph ref="autograph"> </autograph>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button
          @click="
            () => {
              if (this.fileNameWirth == 'edu_photo') {
                this.autographPath3 = this.$refs.autograph.clear();
                this.formLabelAlign.edu_photo = '';
              } else if (this.fileNameWirth == 'jkcns') {
                this.autographPath1 = this.$refs.autograph.clear();
                this.formLabelAlign.jkcns = '';
              } else if (this.fileNameWirth == 'zjbl') {
                this.formLabelAlign.zjbl = '';
                this.autographPath2 = this.$refs.autograph.clear();
              }
              this.conse();
            }
          "
          >清 空</el-button
        >
        <el-button @click="dialogShow = false">取 消</el-button>
        <el-button type="primary" @click="submit">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="提示" :visible.sync="dialogVisible" width="60%">
      <el-input
        v-model="str"
        type="textarea"
        placeholder="请输入内容"
        :autosize="{ minRows: 2 }"
        resize="none"
        :readonly="true"
      ></el-input>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="dialogVisible = false"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <van-popup v-model="showpicker" position="bottom">
      <!-- :min-date="new Date(new Date().getFullYear()-50, 0, 1)" -->
      <van-datetime-picker
        v-model="currentDate"
        type="date"
        title="选择年月日"
        @confirm='changePick'
        @cancel="()=>{this.showpicker=false}"
        :min-date="minDate"
      />
    </van-popup>

    <div style="position: relative;overflow: hidden;">
      <div id="DomImgjkcns" class="DomImg">
      <div class="A4page">
        <h1>个人健康承诺</h1>
        <div style="margin-top: 80px">
          <p style="text-indent: 50px; font-family: '宋体'">
            本人姓名<u>{{ formLabelAlign.nickname }}</u
            >，身份证号码<u>{{ formLabelAlign.username }}</u
            >，现申请<u>{{ subjectTitle }}</u
            >（作业类别）特种作业操作证。本人身体健康，无妨碍从事相应特种作业的器质性心脏病、癫痫病、美尼尔氏症、眩晕症、癔病、震颤麻痹症、精神病、痴呆症以及其他疾病和生理缺陷。本人对以上信息的真实性负责，如有隐瞒，相关责任全部由本人承担。
          </p>
          <div
            style="
              width: 100%;
              display: flex;
              justify-content: flex-end;
              padding-right: 30px;
              margin-top: 150px;
            "
          >
            <span style="font-size: 30px">承诺人（签字）：</span>
            <img :src="autographPath" style="height: 70px" alt="" />
          </div>
          <div style="width: 100%; display: flex; justify-content: flex-end">
            <span style="font-size: 30px; padding: 0 30px"
              >{{ new Date().getFullYear() }}年</span
            >
            <span style="font-size: 30px; padding: 0 30px"
              >{{ new Date().getMonth() + 1 }}月</span
            >
            <span style="font-size: 30px; padding: 0 30px"
              >{{ new Date().getDate() }}日</span
            >
          </div>
        </div>
      </div>
    </div>
    <div id="DomImgXL" class="DomImg">
      <div class="A4page">
        <h1>个人学历承诺</h1>
        <div style="margin-top: 80px">
          <p style="text-indent: 50px; font-family: '宋体'">
            本人姓名<u>{{ formLabelAlign.nickname }}</u
            >，身份证号码<u>{{ formLabelAlign.username }}</u
            >，现承诺，本人具有{{
              formLabelAlign.education
            }}学历，以上内容真实有效，如有虚假，本人愿意承担相应责任
          </p>
          <div
            style="
              width: 100%;
              display: flex;
              justify-content: flex-end;
              padding-right: 30px;
              margin-top: 150px;
            "
          >
            <span style="font-size: 30px">承诺人（签字）：</span>
            <img :src="autographPath" style="height: 70px" alt="" />
          </div>
          <div style="width: 100%; display: flex; justify-content: flex-end">
            <span style="font-size: 30px; padding: 0 30px"
              >{{ new Date().getFullYear() }}年</span
            >
            <span style="font-size: 30px; padding: 0 30px"
              >{{ new Date().getMonth() + 1 }}月</span
            >
            <span style="font-size: 30px; padding: 0 30px"
              >{{ new Date().getDate() }}日</span
            >
          </div>
        </div>
      </div>
    </div>
    <div id="DomImgzjbl" class="DomImg">
      <div class="A4page">
        <h1>证件办理费用协议</h1>
        <div style="margin-top: 80px">
          <div>
            <p>甲方:{{ setting.gsName }}</p>
            <p>乙方:{{ formLabelAlign.nickname }}</p>
          </div>
          <div>
            <p>
              一、甲方依据相关规定收取乙方培训、考试、办理及发放证件等费用，并依法对乙方提供相关服务。
            </p>
            <p>
              二、乙方必须按甲方规定时间进行培训、考试及取证，因乙方个人原因及行为不能按时参加培训、考试及无法取证者，甲方不予退费。
            </p>
            <p>三、从报名开始，六个月之内必须考完，否则视为自动放弃。</p>
            <p>四、代办人员需将本协议告知学员本人。</p>
            <p>本人已阅读并同意上述协议内容。</p>
          </div>
          <div
            style="height: 300px; width: 460px"
            v-if="formLabelAlign.id_card_photo"
          >
            <img
              style="width: 100%; height: 100%"
              crossOrigin="Anonymous"
              :src="formLabelAlign.id_card_photo + '?' + new Date().getTime()"
              alt=""
            />
          </div>
          <!--  v-if="formLabelAlign.id_card_emblem" -->
          <div
            style="height: 300px; width: 460px"
            v-if="formLabelAlign.id_card_emblem"
          >
            <img
              style="width: 100%; height: 100%"
              crossOrigin="Anonymous"
              :src="formLabelAlign.id_card_emblem + '?' + new Date().getTime()"
              alt=""
            />
          </div>
          <div
            style="
              width: 100%;
              display: flex;
              justify-content: flex-end;
              padding-right: 30px;
              margin-top: 100px;
            "
          >
            <span style="font-size: 30px">承诺人（签字）：</span>
            <img
              :src="autographPath"
              v-if="autographPath"
              style="height: 70px"
              alt=""
            />
          </div>
          <div style="width: 100%; display: flex; justify-content: flex-end">
            <span style="font-size: 30px; padding: 0 30px"
              >{{ new Date().getFullYear() }}年</span
            >
            <span style="font-size: 30px; padding: 0 30px"
              >{{ new Date().getMonth() + 1 }}月</span
            >
            <span style="font-size: 30px; padding: 0 30px"
              >{{ new Date().getDate() }}日</span
            >
          </div>
        </div>
      </div>
    </div>
    </div>
  </div>
</template>

<script>
import { applyList, updateApply, regionList ,downloadAll} from "@/api/admin.js";
import simpleCrop from "simple-crop/index.vue";
import "simple-crop/template-1.css";
import { mapGetters } from "vuex";
import { dataURLtoFile } from "@/utils/64batatoFile";
import autograph from "@/components/autograph";
import { upFile, upFileqm } from "@/utils/upFiel.js";
import { getAgent,getuserstate,getcurrentInfo } from "@/utils/auth";
export default {
  computed: {
    ...mapGetters(["initObj"]),
  },
  props: ["userInfo"],
  components: {
    simpleCrop,
    autograph,
  },
  data() {
    return {
      baseUrl:process.env.NODE_ENV === 'development' ? process.env.VUE_APP_BASE_API :window.location.href.slice(0, window.location.href.indexOf('/user')),
      userstate:getuserstate()&&getuserstate()!='undefined'?JSON.parse(getuserstate()):null,
      fromList: [],
      fileListImg:[],
      // userInfo:,
      audit_remark:[],
      formLabelAlign: {
        gz: "",
        extra:{企业性质:''},
      },
      init: {},
      codeChk: "",
      GZList: [],
      qyname: "",
      qylogo: "",
      loading: false,
      fileList: [],
      subjectListTree: [],
      subjectlist: [],
      companytype: "",
      Arrpass: [], //
      titleA: "初培",
      itemA: {}, //当前科目信息
      JsonListFrom: {},
      cropParams: {
        title: "编辑图片(可以拖动边框改变截取图片大小)", //标题
        src: "", // 裁剪图片地址
        size: {
          // 裁剪尺寸
          width: 390,
          height: 567,
        },
        rotateSlider: true, //是否开启旋转刻度盘
        cropSizePercent: 0.65, //裁剪框显示比例
        borderWidth: 1, //裁剪框边框宽度
        funcBtns: ["close", "crop"], //功能按钮配置
        borderColor: "#fff", //裁剪框边框颜色
        coverColor: "rgba(0,0,0,.5)", //裁剪框遮罩颜色
        startAngle: -360, //旋转刻度盘开始角度
        endAngle: 360, //旋转刻度盘结束角度
      },
      isShowImgCard: false,
      dialogShow: false,
      autographPath: "", //签名图片地址 清空或无写入为false
      autographPath1: "", //签名图片地址 清空或无写入为false
      autographPath2: "", //签名图片地址 清空或无写入为false
      autographPath3: "", //签名图片地址 清空或无写入为false
      dialogVisible: false,
      str: "",
      setting: {},
      Domsrc: "", //签名图片
      DomImgShow: false, //健康承诺书
      subjectTitle: "",
      objinvoice: {}, //发票信息
      hutou: "", //发票户头
      shuihao: "", //发票税号
      FpfileList: { fileList: [], field_id: "image" }, //发票图片表
      JkfileList: { fileList: [], field_id: "jkcns" }, //发票图片表
      showBox: false, //特种设备展示模块
      fileNameWirth: "",
      DOMID: "",
      hascodeYes: true,
      codeTime: 60,
      timeObj: Object,
      typeList: [
        "一般工贸",
        "普货运输",
        "危货运输",
        "汽车维修",
        "驾驶培训",
        "危化品",
      ],
      addressList: [
        "禹会",
        "蚌山",
        "龙子湖",
        "经开",
        "高新",
        "淮上",
        "怀远",
        "固镇",
        "五河",
      ],
      http:
        process.env.NODE_ENV === "development"
          ? process.env.VUE_APP_BASE_API
          : window.location.href.slice(
              0,
              window.location.href.indexOf("/user")
            ),

      phonePass:getAgent()==1,
      currentDate:new Date(),//当前选中的日期
      showpicker:false,//打开选择框
      startInfo:{},//当前弹出框的信息
      arrlist:[],
      minDate:new Date(new Date().getFullYear() - 50,0,1),
      // maxDate:new Date(new Date().getFullYear() + 10,11,31)
    };
  },
  watch: {
    fromList(val) {
      this.$forceUpdate();
    },
  },
  created() {
    Object.assign(this.userInfo,JSON.parse(getcurrentInfo()))
    this.init = this.initObj;
    this.GZList = this.init.selected_gz.split(",");
    if (!this.qyType("xtaq")) {
      //大类里面只留下大培训
      this.GZList = ["大培训"];
    }
    if (!this.qyType("yali")) {
      this.GZList.map((item, index) => {
        if (item == "一般工贸") {
          this.GZList[index] = "一般行业";
        }
        if (item == "安全管理") {
          this.GZList[index] = "危化品";
        }
      });
    }
    this.setting = JSON.parse(this.init.setting);
    // if (this.$route.query.name) {
    //   this.formLabelAlign.gz = this.$route.query.name;
    // } else {
    //   this.formLabelAlign.gz = this.GZList[0];
    // }
    this.qyname = this.init.alias;
    this.qylogo = this.init.qylogo;
    this.gzChange(this.userInfo.gz)
    // this.applyListData(this.formLabelAlign.gz);
    // this.subject(this.formLabelAlign.gz);
    if (this.setting.invoice) {
      this.objinvoice = JSON.parse(this.setting.invoice);
    }
    
  },
  methods: {
    conse() {
      this.formLabelAlign[this.fileNameWirth] = "";
      this.formLabelAlign.signature =
        this.formLabelAlign.jkcns ||
        this.formLabelAlign.zjbl ||
        this.formLabelAlign.edu_photo ||
        "";
      this.autographPath = this.formLabelAlign.signature;
      // if(this.fileNameWirth=='edu_photo'){
      //     this.formLabelAlign.edu_photo=''
      // }else if(this.fileNameWirth=='jkcns'){
      //     this.formLabelAlign.jkcns=''
      // }else if(this.fileNameWirth=='zjbl'){
      //     this.formLabelAlign.zjbl=''
      // }
    },
    //获取验证码
    // hoveCode() {
    //   if (!this.formLabelAlign.phone) {
    //     return this.$message.error("手机号不能为空");
    //   }
    //   this.codeTime = 60;
    //   this.hascodeYes = false;
    //   clearInterval(this.timeObj);
    //   sendcode({
    //     mobile: this.formLabelAlign.phone,
    //   }).then((res) => {
    //     if (res.code == 200) {
    //       this.$message.success("验证码发送成功");
    //       this.timeObj = setInterval(() => {
    //         if (this.codeTime <= 0) {
    //           this.hascodeYes = true;
    //           clearInterval(this.timeObj);
    //         }
    //         this.codeTime--;
    //       }, 1000);
    //     }
    //   });
    // },
   async applyListData(gz) {
      var JsJson = function(str){
        try {
          JSON.parse(str)
        } catch(e){
          return false
        }
        return true
      }
      this.loading = true;
      await applyList({ gz, usage: "apply" }).then((res) => {
        this.loading = false;
        if (res.code == 200) {
          this.fromList = res.data
            .filter((item) => item.label != "工种")
            .filter((item) => item.label != "初复审");
          JSON.parse(JSON.stringify(this.fromList))
            .filter((item) => item.field_id == "json")
            .map((item) => {
              JSON.parse(item.options).map((it) => {
                this.JsonListFrom[it.label];
              });
            });
          res.data.map((item) => {
            item.isshow = true;
          });
          res.data.map((item) => {
            if (item.field_id != "gz"&&item.field_id != "extra") {
              // console.log(this.userInfo,'55555');
              item.placeholder = this.userInfo[item.field_id];
              if(item.field_id=='edu_period'&&(!item.placeholder||!JsJson(item.placeholder))){
                item.placeholder='[]'
              }
              this.formLabelAlign[item.field_id] = item.placeholder;
              //field_id=='history'
              if (item.field_type == "datetimeRange") {
                if(this.userInfo[item.field_id]){
                  item.placeholder = JSON.parse(this.userInfo[item.field_id]);
                }else{
                  item.placeholder = ['','至今']
                }
                this.formLabelAlign[item.field_id] = item.placeholder.join()
              }
              
            }
            // if(item.field_id == "extra"){
            //   console.log(this.userInfo.extra,'6666');
            //   this.formLabelAlign.extra=this.userInfo.extra;
            // }
            if(item.field_id == "extra"){
              Object.assign(this.formLabelAlign,{extra:{}})
              JSON.parse(item.options).map(el=>{
                Object.assign(this.formLabelAlign.extra,{[el.field_id]:el.placeholder})
              })
            }
            if(item.field_type=='img'){
              // fileList
              // console.log(item,'222');
              if(this.userInfo[item.field_id]){
                item.fileList=[
                  {
                    name:item.label,
                    url:this.userInfo[item.field_id]
                  }
                ]
              }
              // console.log(this.userstate[item.field_id],'567');
              if(item.field_id=='last_cert'){
                if(this.userInfo[item.field_id]){
                  let arr = []
                  if(JSON.parse(this.userInfo[item.field_id])[1]){
                    arr=[{ name: "", url: JSON.parse(this.userInfo[item.field_id])[0] },{ name: "", url:JSON.parse(this.userInfo[item.field_id])[1]}];
                  }else{
                    arr = [{ name: "", url: JSON.parse(this.userInfo[item.field_id])[0] }]
                  }
                  item.fileList = arr
                }
              }
            }
            // if(item.label=='学历起止时间'||item.label=="学习工作经历"){
            //   item.placeholder=JSON.parse(item.placeholder)
            // }
            if (gz == "特种作业") {
              if (item.label == "现持证书信息") {
                item.isshow = false;
              }
              if(this.platformAnhui()){
                if (item.field_id=="last_cert") {
                  if (this.userInfo.exam_type=='初培') {
                    item.isshow = false;
                  } else {
                    item.isshow = true;
                  }
                }
              }
            }
            if (item.label == "培训科目") {
              item.isshow = false;
            }
            if (gz == "一般工贸") {
              if (item.label == "安全合格证证号" || item.label == "截止日期") {
                item.isshow = false;
              }
              if(this.platformAnhui()){
                if (item.field_id=="last_cert") {
                  if (this.userInfo.exam_type=='初培') {
                    item.isshow = false;
                  } else {
                    item.isshow = true;
                  }
                }
              }
            }
            if(gz=='安全管理'){
              if(this.platformAnhui()){
                if (item.field_id=="last_cert") {
                  if (this.userInfo.exam_type=='初培') {
                    item.isshow = false;
                  } else {
                    item.isshow = true;
                  }
                }
              }
            }
            // if(gz=='特种作业'&&item.label=='安全生产管理人员安全合格证证号'){
            //     item.isshow = false
            // }
            // if(gz=='特种作业'&&item.label=='安全生产管理人员安全合格证证号'){
            //     item.isshow = false
            // }
            
          });
          console.log(this.userInfo,'8888');
          this.formLabelAlign.extra=this.userInfo.extra;
          this.fileListImg=[]
          if(this.userInfo.attachment){
            JSON.parse(this.userInfo.attachment).map(item=>{
              this.fileListImg.push({
                name:'',
                url:item,
              })
            })
          }
          this.Arrpass = res.data;
          this.subChange()
          // for (const item in this.formLabelAlign) {
          //   this.formLabelAlign[item] = this.userInfo[item];
          // }
        }
      });
    },
    //切换工种
    gzChange(value) {
      this.titleA = "初培";
      this.subjectTitle=this.userInfo
      let str = value;
      this.fromList = [];
      if (!this.qyType("yali")) {
        if (str == "一般行业") {
          str = "一般工贸";
        }
        if (str == "危化品") {
          str = "安全管理";
        }
      }
      if (this.http.indexOf("taihua") != -1) {
        if (value != "学历提升") {
          this.applyListData(str);
        }
      } else {
        this.applyListData(str);
      }
      this.formLabelAlign.gz = value;
      if (this.formLabelAlign.gz == "特种设备") {
        this.showBox = true;
      } else {
        this.showBox = false;
      }
      // this.subject(str);
      if (str == "特种设备") {
        this.showBox = true;
      } else {
        this.showBox = false;
      }
      // this.userInfo
      // this.formLabelAlign
    },
    //点击输入框
    clickInput(data){
      console.log(data,'678');
      data.placeholder[1] = null
      this.$forceUpdate()
      this.$nextTick(()=>{
        this.$refs.updataDatePicker[0].$el.getElementsByTagName('input')[0].focus()
        // this.$refs.updataDatePicker[0].$children[0].$el.click()
      })
    },
    //init
    // async init(){
    //    await applyInit().then( res=>{
    //         if(res.code==200){
    //             console.log(res)
    //             this.GZList=res.data.selected_gz.split(',')
    //             this.qyname=res.data.alias
    //             this.formLabelAlign.gz=this.GZList[0]
    //             this.applyListData(this.GZList[0])
    //             this.subject(this.GZList[0])
    //         }
    //     })
    // },
    //科目
    subject(gz) {
      subjectList(gz).then((res) => {
        this.subjectListTree = res;
        if (!this.qyType("xtaq") || !this.qyType("zcaq")) {
          this.subjectListTree = res.filter((item) => {
            return item.id == 794;
          });
        }
      });
    },
    //科目切换
    subChange(value) {
      // this.formLabelAlign.subject_id = value[value.length - 1];
      // this.formLabelAlign.subject_ids = value.join(",");
      // this.deep(this.subjectListTree, this.formLabelAlign.subject_id);

      // this.deep2(this.subjectListTree, value[0]);
      // if (this.titleA == "初培" || this.titleA == "复审") {
      //   this.formLabelAlign.exam_type = this.titleA;
      // } else {
      //   this.formLabelAlign.exam_type = "初培";
      // }
      let gz = this.formLabelAlign.gz;
      this.Arrpass.map((item) => {
        item.isshow = true;
      });
      this.Arrpass.map((item) => {
        if (gz == "特种作业") {
          if(this.platformAnhui()){
            if (item.field_id=="last_cert") {
              if (this.titleA.indexOf("初培") != -1) {
                item.isshow = false;
              } else {
                item.isshow = true;
              }
            }
          }else{
            if (item.label == "现持证书信息") {
              if (this.titleA.indexOf("初培") != -1) {
                item.isshow = false;
              } else {
                item.isshow = true;
              }
            }
            if (item.label == "户口本" || item.label == "毕业证") {
              if (this.titleA.indexOf("复审") != -1) {
                item.isshow = false;
              } else {
                item.isshow = true;
              }
            }
          }
          
        }
        if (gz == "一般工贸") {
          if(this.platformAnhui()){
            if (item.field_id=="last_cert") {
              if (this.titleA.indexOf("初培") != -1) {
                item.isshow = false;
              } else {
                item.isshow = true;
              }
            }
          }else{
            if(item.label == "安全合格证证号" || item.label == "截止日期"){
              if (this.titleA.indexOf("初培") != -1) {
                item.isshow = false;
              } else {
                item.isshow = true;
              }
            }
          }
          
        }
        if(gz=='安全管理'){
          if(this.platformAnhui()){
            if (item.field_id=="last_cert") {
              if (this.titleA.indexOf("初培") != -1) {
                item.isshow = false;
              } else {
                item.isshow = true;
              }
            }
          }
        }
        if(gz == '职业卫生'){
          if(!this.qyType('ataq')){
            if(item.field_id=='training_record'){
              if (this.titleA.indexOf("初培") != -1) {
                item.isshow = false;
              } else {
                item.isshow = true;
              }
            }
          }
        }
      });
      this.$forceUpdate();
    },
    //递归
    deep(subjectListTree = [], id) {
      for (let i = 0; i < subjectListTree.length; i++) {
        let item = subjectListTree[i];
        if (item.id == id) {
          this.titleA = item.title;
          this.itemA = item;
          break;
        } else if (item.children) {
          this.deep(item.children, id);
        }
      }
    },
    //递归2
    deep2(subjectListTree = [], id) {
      for (let i = 0; i < subjectListTree.length; i++) {
        let item = subjectListTree[i];
        if (item.id == id) {
          this.subjectTitle = item.title;
          break;
        } else if (item.children) {
          this.deep2(item.children, id);
        }
      }
    },
    //科目初复审校验
    // subjectitem(value){
    //     switch(this.formLabelAlign.gz){
    //         case '特种作业':
    //             return value=='初培'?true:false;
    //         case '安全管理':
    //             return value=='初培'?true:false;
    //     }
    // },
    //input输入框 改变时触发
    inputChange(data, txt,value) {
      this.formLabelAlign[data.field_id] = data.placeholder;
      if(value){this.formLabelAlign[data.field_id] = value}
      // if(txt=="dep"){
      //     this.formLabelAlign[data.field_id] = data.placeholder.join(',')
      // }
      if (txt == "region_id") {
        this.formLabelAlign[data.field_id] = data.placeholder.join(",");
      }
      if (txt == "json") {
        this.formLabelAlign[data.field_id] = JSON.stringify(this.JsonListFrom);
      }
      if (txt == "time") {
        if(data.field_id=='history'){
          console.log(data,'666');
          this.formLabelAlign[data.field_id] = JSON.stringify([data.placeholder,'至今']);
        }else{
          this.formLabelAlign[data.field_id] = JSON.stringify(data.placeholder);
        }
      }
      this.$forceUpdate()
    },
    //剪辑图片
    crop(data) {
      this.isShowImgCard = false;
      this.asrsc = data.toDataURL();
      let file = dataURLtoFile(data.toDataURL());
      this.pearit.fileList = [
        {
          url: data.toDataURL(),
          name: "",
        },
      ];
      let srt = "img" + this.pearit.field_id;
      if (this.$refs[srt][0]) {
        this.$refs[srt][0].uploadImg(file);
      } else {
        this.$refs[srt].uploadImg(file);
      }
      // console.log()
    },
    //关闭剪辑
    closeCallback() {
      this.isShowImgCard = false;
    },
    //图片编辑
    PictureCard(item, file) {
      this.pearit = item;
      this.isShowImgCard = true;
      this.cropParams.src = file.url;
    },
    openCardBox(row,id){
      this.showpicker=true
      // this.startInfo=row
      Object.assign(this.startInfo,row,{num:id})

    },
    //
    changePick(val){
      this.startInfo.placeholder[this.startInfo.num-1] = this.$moment(val).format("YYYY-MM-DD")
      this.formLabelAlign[this.startInfo.field_id] = JSON.stringify(this.startInfo.placeholder);
      this.$forceUpdate()
      this.showpicker=false
    },
    //上传照片时 触发
    upChange(file) {
      if(file.status=='ready'){
          this.arrlist = []
      }
      if (file.status == "success" && file.response.code == 200) {
        if(file.response.data.field=='last_cert'){
          this.arrlist.push(file.response.data.url)
          this.formLabelAlign.last_cert=JSON.stringify(this.arrlist)
        }else{
          this.formLabelAlign[file.response.data.field] = file.response.data.url;
        }
        this.$message.success(file.response.msg);
        if (file.response.data.field == "hukou_photo") {
          this.Arrpass.map((item) => {
            if (item.field_id == "edu_photo") {
              item.selected = 0;
            }
          });
        } else {
          this.Arrpass.map((item) => {
            if (item.field_id == "edu_photo") {
              item.selected = 1;
            }
          });
        }
        if (file.response.data.field == "edu_photo") {
          this.Arrpass.map((item) => {
            if (item.field_id == "hukou_photo") {
              item.selected = 0;
            }
          });
        } else {
          this.Arrpass.map((item) => {
            if (item.field_id == "hukou_photo") {
              item.selected = 1;
            }
          });
        }
        //autographPath1
        // if(file.response.data.field=='jkcns'){
        //     this.autographPath1=file.response.data.url
        // }
      } else if (file.status == "success" && file.response.code != 200) {
        this.$message.error(file.response.msg);
      }
    },
    //删除照片时 触发
    remove(id) {
      this.formLabelAlign[id] = "";
    },
    //提交
    commit() {
      // window.open(this.http+'/user/#/login?username='+this.formLabelAlign.username,'_self')
      let formLabelAlign = {};
      let a = JSON.parse(JSON.stringify(this.formLabelAlign))
      Object.keys(a).map(item=>{
        this.Arrpass.map(el=>{
          if(el.field_id==item){
            console.log(item,'77888');
            formLabelAlign[item] = a[item]
          }
          if(item=='id_card'){
            formLabelAlign['id_card_emblem'] = a['id_card_emblem']?a['id_card_emblem']:''
            formLabelAlign['id_card_photo'] = a['id_card_photo']?a['id_card_photo']:''
            delete formLabelAlign[item]
          }
        })
      })
      formLabelAlign.subject_ids = this.userInfo.subject_ids
      formLabelAlign.subject_id = this.userInfo.subject_id
      formLabelAlign.gz = a.gz
      formLabelAlign.dep = a.dep
      formLabelAlign.signature = a.signature
      formLabelAlign.applyid = this.userInfo.applyid;
      // console.log(formLabelAlign,'6666');
      // return
      if((!formLabelAlign.last_cert||formLabelAlign.last_cert=='[]')&&formLabelAlign.last_cert!=undefined){
        return this.$message.warning("初审证书不能为空");
      }
      if(getuserstate()&&getuserstate()!='undefined'){
        if(!this.audit_remark||this.audit_remark.length==0){
          
        }else{
          formLabelAlign.attachment=JSON.stringify(this.audit_remark)
          formLabelAlign.extra.attachment=true
        }
      }
      // console.log(formLabelAlign,'6666');
      // return
      if (!this.qyType("yali")) {
        if (formLabelAlign.gz == "一般行业") {
          formLabelAlign.gz = "一般工贸";
        }
        if (formLabelAlign.gz == "危化品") {
          formLabelAlign.gz = "安全管理";
        }
      }
      if (this.hutou) {
        formLabelAlign.hutou = this.hutou;
      }
      if (this.shuihao) {
        formLabelAlign.shuihao = this.shuihao;
      }
      if (this.codeChk) {
        formLabelAlign.codeChk = this.codeChk;
      }
      let IDCard =
        /^[1-9]\d{5}(17|18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9X]$/; //身份证号校验
      let phone = /^1[3456789]\d{9}$/; //手机号校验
      // console.log(this.Arrpass)
      // return
      for (let i = 0; i < this.Arrpass.length; i++) {
        let items = this.Arrpass[i];
        if (items.field_id == "exam_type") {
          continue;
        }
        if (
          Boolean(items.selected) &&
          !formLabelAlign[items.field_id] &&
          items.isshow &&
          items.field_id != "cert"
        ) {
          this.$message.warning(items.label + "不能为空");
          return;
        }
        if (
          Boolean(items.selected) &&
          items.field_id == "cert" &&
          items.isshow
        ) {
          let obj = JSON.parse(formLabelAlign[items.field_id]);
          if (formLabelAlign[items.field_id] == "[]") {
            this.$message.warning(items.label + "不能为空");
            return;
          }
          let list = JSON.parse(items.options);
          for (let j = 0; j < list.length; j++) {
            if (!obj[list[j].label]) {
              this.$message.warning(list[j].label + "不能为空");
              return;
            }
          }
        }
        if (
          items.field_id == "username" &&
          Boolean(items.selected) &&
          !IDCard.test(formLabelAlign.username)
        ) {
          this.$message.warning("身份证不合法");
          return;
        }
        if (
          items.field_id == "phone" &&
          Boolean(items.selected) &&
          !phone.test(formLabelAlign.phone)
        ) {
          this.$message.warning("手机号码不合法");
          return;
        }
      }
      if (
        (!this.qyType("hzdpx") ||
          !this.qyType("xtaq") ||
          (!this.qyType("zcaq") && formLabelAlign.gz == "大培训")) &&
        !formLabelAlign.codeChk
      ) {
        return this.$message.error("请输入验证码");
      }
      if (
        (!this.qyType("lyjc")&&formLabelAlign.gz == "特种作业")
      ) {
        if(!formLabelAlign.edu_period||formLabelAlign.edu_period=='[]'){
          return this.$message.error("学历起止时间不能为空!");
        }
        if(!formLabelAlign.history||formLabelAlign.history=='[]'){
          return this.$message.error("学习工作经历不能为空!");
        }else{
          console.log(formLabelAlign.history);
          var JsJson = function(str){
            try {
              JSON.parse(str)
            } catch(e){
              return false
            }
            return true
          }
          if(JsJson(formLabelAlign.history)){
            JSON.parse(formLabelAlign.history)[1] = '至今'
          }else{
            formLabelAlign.history = JSON.stringify([formLabelAlign.history,'至今'])
          }
          // JSON.parse(formLabelAlign.history)[1]='至今'
          // JSON.stringify
          // console.log(formLabelAlign.history,999);
        }
      }
      // return
      formLabelAlign.extra=JSON.stringify(formLabelAlign.extra)
      this.loading = true;
      updateApply(formLabelAlign).then((res) => {
        this.loading = false;
        if (res.code == 200) {
          this.$message.success(res.msg);
        } else {
          this.$message.error(res.msg);
        }
      });
    },
    lazyLoad(node, resolve) {
      let id = node.data ? node.data.region_id : 0;
      regionList({ region_pid: id }).then((res) => {
        console.log(123,res);
        resolve(res.data.list);
      });
    },
    //附件下载
    downloadImg(){
      if(!this.userstate.attachment||this.userstate.attachment=='[]'){
        return this.$message.error('暂无附件')
      }
      let imglist = JSON.parse(this.userstate.attachment)
      if(this.phonePass){
        imglist.map((item)=>{
          window.open(item)
        })
      }else{
        imglist.map((item)=>{
          setTimeout(()=>{
            downloadAll(item,'登记表')
          },1000)
        })
      }
    },
    //
    downloadImg2(name){
      if(this.platformAnhui()&&this.platformAnhui().length!=0){
        this.platformAnhui().forEach(item=>{
          if(item.gz.includes(this.formLabelAlign.gz)&&item.name==name){
            if(this.phonePass){
              window.open(item.filePath)
            }else{
              downloadAll(item.filePath, item.name);
            }
          }
        })
      }
      // if(this.formLabelAlign.gz=='特种作业'){
      //   if(this.phonePass){
      //     window.open('https://dkaq.taijieyun.com/storage/userimage/dkaq/20221112/f05bc6588958ee78f2b4e0ef73d8fb75.doc')
      //   }else{
      //     downloadAll('https://dkaq.taijieyun.com/storage/userimage/dkaq/20221112/f05bc6588958ee78f2b4e0ef73d8fb75.doc','特种作业操作证考核申请表')
      //   }
      // }
      // if(this.formLabelAlign.gz=='一般工贸'||this.formLabelAlign.gz=='安全管理'){
      //   if(this.phonePass){
      //     window.open('https://dkaq.taijieyun.com/storage/userimage/dkaq/20221112/2b87a6686432df1d1e7e053735483d0d.doc')
      //   }else{
      //     downloadAll('https://dkaq.taijieyun.com/storage/userimage/dkaq/20221112/2b87a6686432df1d1e7e053735483d0d.doc','特种作业操作证考核申请表')
      //   }
      // }
    },
    //打开签名
    writeName(name, id) {
      if (name == "jkcns") {
        if (!this.formLabelAlign.nickname) {
          return this.$message.error("姓名不能为空");
        }
        if (!this.formLabelAlign.username) {
          return this.$message.error("身份证号不能为空");
        }
        if (!this.subjectTitle) {
          return this.$message.error("请选择培训科目后再签名");
        }
      }
      this.fileNameWirth = name;
      this.DOMID = id;
      this.dialogShow = true;
    },
    //打开承诺书
    openBook() {
      //  this.DomImgShow=true
      this.$alert(
        "本人身体健康，无妨碍从事相应特种作业的器质性心脏病、癫痫病、美尼尔氏症、眩晕症、癔病、震颤麻痹症、精神病、痴呆症以及其他疾病和生理缺陷。本人对以上信息的真实性负责，如有隐瞒，相关责任全部由本人承担。",
        "健康承诺",
        {
          confirmButtonText: "确定",
        }
      );
    },
    //证件办理费用协议
    openBookXY() {
      //  this.DomImgShow=true
      this.$alert(
        " 一、甲方依据相关规定收取乙方培训、考试、办理及发放证件等费用，并依法对乙方提供相关服务。二、乙方必须按甲方规定时间进行培训、考试及取证，因乙方个人原因及行为不能按时参加培训、考试及无法取证者，甲方不予退费。三、从报名开始，六个月之内必须考完，否则视为自动放弃。四、代办人员需将本协议告知学员本人。",
        "证件办理费用协议",
        {
          confirmButtonText: "确定",
        }
      );
    },
    openBookXl() {
      if (!this.formLabelAlign.education) {
        return this.$message.error("请选择您的学历!");
      }
      this.$alert(
        `我承诺：本人具有${this.formLabelAlign.education}学历，以上内容真实有效，如有虚假，本人愿意承担相应责任`,
        "学历承诺",
        {
          confirmButtonText: "确定",
        }
      );
    },
    //示例图片
    openDefimg(path) {
      this.$alert(
        `<div style="display: flex;justify-content: center;align-items: center;background:#eee;"><img src="${path}" style="height:313px;width:206.5px;" alt="示例图片"></div>`,
        "示例图片",
        {
          confirmButtonText: "确定",
          dangerouslyUseHTMLString: true,
        }
      );
    },
    //提交签名图片
    submit(file) {
      // dialogShow = false
      this.autographPath = this.$refs.autograph.commit();
      let field_type = "sign";
      this.fromList.map((item) => {
        if (item.field_id == this.fileNameWirth) {
          field_type = item.field_type;
        }
      });
      // if (this.DOMID == "DomImgzjbl") {
      //   this.autographPath2 = this.$refs.autograph.commit(); //证件办理协议
      // } else if (this.DOMID == "DomImgXL") {
      //   this.autographPath3 = this.$refs.autograph.commit(); //个人学历承诺
      // } else if (this.DOMID == "DomImgjkcns") {
      //   this.autographPath1 = this.$refs.autograph.commit(); //健康承诺书
      // }
      // if(!this.formLabelAlign.extra){
      //   this.formLabelAlign.extra = {}
      // }
      upFileqm(this.autographPath, this.formLabelAlign.nickname, {
        field: "signature",
      }).then((res) => {
        if (res.code == 200) {
          this.formLabelAlign.signature = res.data.url;
          this.formLabelAlign[this.fileNameWirth] = res.data.url;
          if(this.DOMID){
          }else{
            this.formLabelAlign.extra[this.fileNameWirth] = res.data.url;
            this.$message.success("提交成功");
            this.dialogShow = false;
          }
          this.$forceUpdate()
        }
      });
      if(field_type!="sign"){
        setTimeout(() => {
          upFile(
            this.formLabelAlign.nickname + this.fileNameWirth,
            { field: this.fileNameWirth },
            this.DOMID
          ).then((res) => {
            if (res.code == 200) {
              this.$message.success("提交成功");
              // this.autographPath = res.data.url
              this.formLabelAlign[this.fileNameWirth] = res.data.url;
              this.dialogShow = false;
            } else {
              this.$message.error("签名失败");
            }
          });
        }, 200);
      }
    },
     //上传
    fileSuccess(response, file, fileList){
      let str=''
      this.audit_remark=[]
      fileList.map((item,index)=>{
        if(item.response){
          if(item.response.code==200){
            this.audit_remark.push(item.response.data.url)
          }else{
            str+=`${item.name},${item.response.msg},`
          }
        }
        if(index==fileList.length-1&&str){
          this.$message.error(str)
        }
      })
    },
    //移出上传文件
    removeFile(file, fileList){
      this.audit_remark=[]
      fileList.map((item,index)=>{
        if(item.response){
          this.audit_remark.push(item.response.data.url)
        }
      })
    },
    //下载学历承诺书
    downReader() {
      download(
        "https://lyky.taijieyun.com/template/lyky/%E5%AD%A6%E5%8E%86%E6%89%BF%E8%AF%BA%E4%B9%A6.docx",
        "学历承诺书.docx"
      );
    },
    //下载健康查体表
    downFuled() {
      download(
        "https://lyky.taijieyun.com/template/lyky/%E4%BD%93%E6%A3%80%E8%A1%A8.doc",
        "健康查体表.doc"
      );
      //https://lyky.taijieyun.com/template/lyky/%E4%BD%93%E6%A3%80%E8%A1%A8.doc
    },
    //太化 提交
    commitA() {
      if (this.$refs.taihua.commit()) {
        let objA = this.$refs.taihua.commit()[0];
        let objB = this.$refs.taihua.commit()[1];
        this.loading = true;
        applyAdd({ ...objA }).then((res) => {
          this.loading = false;
          if (res.code == 200) {
            this.$confirm(
              "报名成功，管理员审核成功后即可开通培训权限",
              "提示",
              {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "success",
                showClose: false,
              }
            )
              .then(() => {
                this.$router.push("/");
              })
              .catch(() => {});
          } else {
            this.$message.error(res.msg);
          }
        });
      }
    },
  },
};
</script>


<style lang="scss">
.el-message-box{
  max-width: 420px !important;
  width: auto !important;
}
</style>
<style lang="scss" scoped>
.big_box {
  // background: url("~@/assets/BmBj.jpg");
  // background-size: 100%;
  width: 100%;
  height: 100%;
  // display: flex;
  // justify-content: center;
  // align-items: center;
  position: relative;
  // overflow: hidden;
  // overflow: auto;
}
.conter_box {
  display: flex;
  // justify-content: center;
  // align-items: center;
  width: 63%;
  height: 65%;
  // background: #fff;
  .conter_item_left {
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    width: 45%;

    .img_box {
      width: 80px;
      height: 80px;
      margin-bottom: 40px;
      img {
        width: 100%;
      }
    }
    .box_title {
      p {
        color: #fff;
        font-size: 3.7vh;
        margin: 0;
        &::before {
          content: "";
          display: block;
          margin-bottom: 40px;
          width: 28px;
          height: 4px;
          background: #fff;
        }
      }
    }
    .no_copy {
      color: #fff;
      font-size: 14px;
      width: 410px;
    }
  }
  .conter_item_right {
    flex: 1;
    // background: #f0f;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    .positionA {
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      margin: auto;
      width: 90%;
      height: 80%;
      background: #fff;
      opacity: 0.2;
      border-radius: 24px;
    }
    .positionB {
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      margin: auto;
      width: 80%;
      height: 90%;
      opacity: 0.2;
      background: #fff;
      border-radius: 24px;
    }
    .positionC {
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      margin: auto;
      width: 70%;
      height: 100%;
      background: #fff;
      border-radius: 24px;
      .box_form {
        padding: 36px 0;
        height: 100%;
        display: flex;
        flex-direction: column;
        // align-items: center;
        .box_form_title {
          display: flex;
          justify-content: center;
        }
        p {
          font-size: 24px;
          font-weight: 600;
          padding-bottom: 36px;
        }
        .el-form-item {
          margin-bottom: 16px;
        }
        .el-select {
          width: 100%;
        }
        .el-form {
          height: calc(100% - 100px);
          overflow: auto;
          padding: 0 24px;
          &::-webkit-scrollbar {
            width: 5px;
            //   height:5px;
          }
          &::-webkit-scrollbar-thumb {
            border-radius: 15px;
            // -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
            background: rgba(0, 0, 0, 0.2);
          }
          &::-webkit-scrollbar-track {
            // -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
            border-radius: 0;
            background: rgba(0, 0, 0, 0.1);
          }
          ::v-deep {
            .ant-input {
              height: 40px;
            }
            .el-cascader {
              width: 100% !important;
            }
            .el-date-editor {
              width: 100% !important;
            }
          }
          .classJson {
            ::v-deep {
              & > .el-form-item__content {
                margin-left: 0 !important;
              }
            }
          }
        }
        .el-button {
          font-size: 12px;
          padding: 10px 20px;
        }

        // .el-input__inner{
        //     height: ;
        // }
      }
    }
  }
}
@media screen and (min-height: 890px) and (max-height: 960px) {
  ::v-deep {
    .el-form {
      max-height: calc(100% - 100px) !important;
    }
  }
}
@media screen and (min-height: 820px) and (max-height: 889px) {
  ::v-deep {
    .el-form {
      max-height: calc(100% - 100px) !important;
    }
  }
}
@media screen and (min-height: 760px) and (max-height: 819px) {
  ::v-deep {
    .el-form {
      max-height: calc(100% - 100px) !important;
    }
  }
  .conter_box {
    height: 80%;
    width: 75%;
  }
}
@media screen and (min-height: 650px) and (max-height: 759px) {
  ::v-deep {
    .el-form {
      max-height: calc(100% - 100px) !important;
    }
    .el-form-item__label {
      line-height: 32px;
    }
    .el-form-item__content {
      line-height: 32px;
      .el-input {
        line-height: 32px;
        .el-input__inner {
          height: 32px;
          line-height: 32px;
        }
      }
    }
    .ant-input {
      height: 32px;
    }
    .el-select {
      line-height: 32px;
      .el-input {
        line-height: 32px;
        .el-input__inner {
          height: 32px;
          line-height: 32px;
        }
        .el-input__suffix {
          line-height: 32px;
          .el-input__suffix-inner {
            line-height: 32px;
            .el-select__caret {
              line-height: 32px;
            }
          }
        }
      }
    }
    .el-button {
      font-size: 12px;
      padding: 8px 16px;
    }
  }
  .conter_box {
    height: 85%;
    width: 75%;
  }
}
@media screen and (max-height: 650px) {
  ::v-deep {
    .el-form {
      max-height: calc(100% - 100px) !important;
    }
  }
  .conter_box {
    height: 90%;
    width: 75%;
  }
}
::v-deep {
  .el-form-item__content {
    line-height: 16px !important;
  }
  .el-dialog{
    width: auto !important;
    max-width:570px !important;
  }
  .el-form-item {
    margin-bottom: 16px;
  }
}
.DomImg {
  position: absolute;
  z-index: -5;
  background: #fff;
  .A4page {
    width: calc(595px * 2);
    height: calc(840px * 2);
    // background:url('~@/assets/logo/pdfbg.png') no-repeat;
    overflow: hidden;
    -webkit-print-color-adjust: exact;
    color: #000;
    position: relative;
    padding: 150px 150px;
    u {
      // text-decoration:underline;
      border-bottom: 1px solid #333;
      // display: inline-block;
      // padding:0 80px;
    }
    p {
      margin: 0;
      font-size: 30px;
      line-height: 80px;
    }
    h1 {
      text-align: center;

      // font-weight: 600;
      font-size: 40px;
    }
  }
}
#DomImgzjbl {
  top: 0;
  // z-index: 5;
  .A4page {
    padding: 50px 150px;
    p {
      line-height: 60px;
    }
  }
}
::v-deep{
  .sirUpload{
    .el-upload-list{
      position: relative;
      left: -190px;
      width: 180%;
    }
  }
}
</style>
